<extend name="template/base_index" />

<block name="area_header">
	<script type="text/javascript" src="__CDN__/jquery-validation/1.13.1/jquery.validate.min.js"></script>
	<script type="text/javascript" src="__CDN__/jquery-validation/1.13.1/localization/messages_zh.min.js"></script>

    <link type="text/css" rel="stylesheet" href="__CDN__/select2/4.0.0/css/select2.min.css" />
    <script type="text/javascript" src="__CDN__/select2/4.0.0/js/select2.min.js"></script>


</block>

<block name="area_body">
	{:W('Menus/topbar')}
	<div class="admin-main container-fluid">
		{:W('Menus/left')}
		<div class="admin-main-content">
			{:W('Menus/breadcrumb')}

			<form class="form form-horizontal validateForm deliverForm">
				<input type="hidden" value="{$order.uid}" name="uid" />
				<input type="hidden" value="{$order.order_code}" name="ordercode" />
				<input type="hidden" value="{$order.id}" name="orderOfid" />
				<input type="hidden" value="{$express.id}" name="id" />
				<fieldset>
					<legend>发货信息填写
						<div class="form-group">
							<label class="control-label col-lg-2 col-md-2">&nbsp;</label>
							<div class="col-lg-10 col-md-10">
								<a target-form="deliverForm" href="{:U('Admin/Orders/deliver')}" class="ajax-post btn btn-default btn-sm"><i class="fa fa-save"></i>保存</a>
								<a href="javascript:history.back(-1);" class="btn btn-default btn-sm"><i class="fa fa-reply"></i>返回</a>
							</div>
							<span class="help-block h4">保存将对订单进行发货操作，可多次修改已发货商品的发货信息！</span>
						</div>
						<div class="form-group">
							<label class="control-label col-lg-2 col-md-2">快递公司</label>
							<div class="col-lg-10 col-md-10">
								<select name="expresscode" id="expresscode" class="required form-control">
									<foreach name="expresslist" item="vo" key="k">

										<option value="{$k}" <eq name="express.expresscode" value="$k" >selected="selected"</eq> >{$vo}</option>

                                    </foreach>
								</select>
							</div>
						</div>

						<div class="form-group">
							<label class="control-label col-lg-2 col-md-2">快递单号</label>
							<div class="col-lg-10 col-md-10">
								<input type="text" name="expressno" id="expressno" value="{$express.expressno}" placeholder="请输入快递单号" class="required form-control" />
								<a href="javascript:void(0)" class="btn btn-sm btn-default js_random_str hide"><i class="fa fa-random"></i>随机生成</a>
							<div class="help-block hide">如果没有快递单号，请点击[随机生成]</div>
							</div>
						</div>

						<div class="form-group">
							<label class="control-label col-lg-2 col-md-2">备注</label>
							<div class="col-lg-10 col-md-10">
								<textarea class="form-control" name="note" rows="3" placeholder="可填写备注信息">{$express.note}</textarea>
							</div>
						</div>

						<label class="control-label col-lg-2 col-md-2">&nbsp;</label>
						<div class="col-lg-10 col-md-10">
							<a target-form="deliverForm" href="{:U('Admin/Orders/deliver')}" class="ajax-post btn btn-default btn-sm"><i class="fa fa-save"></i>保存</a>
							<a href="javascript:history.back(-1);" class="btn btn-default btn-sm"><i class="fa fa-reply"></i>返回</a>
						</div>
					</legend>
				</fieldset>
			</form>

			<script type="text/javascript">
				
				function randomString(len) {
				　　len = len || 32;
				　　var $chars = 'abcdefhijkmnprstwxyz2345678';    /****默认去掉了容易混淆的字符oOLl,9gq,Vv,Uu,I1****/
				　　var maxPos = $chars.length;
				　　var pwd = '';
				　　for (i = 0; i < len; i++) {
				　　　　pwd += $chars.charAt(Math.floor(Math.random() * maxPos));
				　　}
				　　return pwd;
				}
				
				$(function() {
					$(".js_random_str").click(function(ev){
						var rand_str = $("#expresscode").val()+"_{$order.orderid}";
						
						$("#expressno").val(rand_str);
						
					});

                    $("#expresscode").select2();
					
				});
			</script>
		</div>
		<!-- END admin-main-content -->
	</div>
	<!-- END admin-main-->
</block>

<block name="area_footer">

</block>